﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.RB
{
    class Class11
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string s = ppa.PolicyActing.Policy.SelectedColRateFactors["领取时间"];

            int a = int.Parse(s.Substring(0, 2));

            if (ppa.Age < a)
            {
                da.Value = ppa.PolicyActing.Policy.Fee * 0.01;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string s = ppa.PolicyActing.Policy.SelectedColRateFactors["领取时间"];

            int a = int.Parse(s.Substring(0, 2));

            if (ppa.Age <a)
            {
                da.Value = ppa.Amount * 0.1;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string s = ppa.PolicyActing.Policy.SelectedColRateFactors["领取时间"];

            int a = int.Parse(s.Substring(0, 2));

            if (ppa.Age >= a && ppa.Age< 75)
            {
                da.Value = ppa.Amount * 0.2;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 75)
            {
                da.Value = ppa.Amount;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            

            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                string s = ppa.PolicyActing.Policy.SelectedColRateFactors["领取时间"];
                int a = int.Parse(s.Substring(0, 2));

                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else if (ppa.Age < a)
                {
                    da.Value = ppa.Amount * 2 + ppa.TotalFee;
                }
                else
                {
                    da.Value = (75 - ppa.Period) * 0.2 * ppa.Amount + ppa.Amount;
                }

                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("意外身故"))
            {
                ppa.SchemePeriodActing.InsurantStates.Add("身故");
                
                string s = ppa.PolicyActing.Policy.SelectedColRateFactors["领取时间"];
                int a = int.Parse(s.Substring(0, 2));

                if (ppa.Age < a)
                {
                    da.Value = ppa.Amount * 8;
                }

                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount;

                ppa.IsCurrentFinish = true;
            }

        }
    }
}
